(async function () {
  /**
  const ReadStream = require('../input/oracleReader.js');
  const reader = await ReadStream({
    user: 'hu_user',
    password: 'hisuser',
    connectString: `192.192.192.199:1521/HISDB`,
    sql: 'select table_name from user_tables'
  });
  /**
  const ReadStream = require('../input/mysqlReader.js');
  const reader = ReadStream({
    host: 'localhost',
    port: '3306',
    user: 'root',
    password: 'haosql',
    database: 'xs_qm',
    table: 'accounts',
  });
  /**
  const excelReader = require('../input/excelReader.js');
  const reader = excelReader('1.xlsx');
  /**/
  const jsonReader = require('../input/jsonReader.js');
  const reader = await jsonReader('2.js', 'function');
  /**/
  const ExcelWriter = require('../output/excelWriter.js');
  const TextWriter = require('../output/textWriter.js');
  const JsonWriter = require('../output/jsonWriter.js');
  const TransformStream = require('../transform/fieldTransform.js');
  const PostStream = require('../transform/postTransform.js');
  const ScriptTransform = require('../transform/scriptTransform.js');
  const UniqueTransform = require('../transform/uniqueTransform.js');
  const GroupTransform = require('../transform/groupTransform.js');
  const MongodbWriter = require('../output/mongodbWriter.js');

  // const transformer = TransformStream({ useNewName: true, list: [{ name: 'name', newName: '姓名', value: o => o + 'xxx' }, { name: 'age', value: '$+50+_.random(1, 10)' }, { name: 'class', newName: '班级' }] });
  // const transformer = TransformStream({ useNewName: true, list: [{ name: 'name', newName: '姓名', value: o => o + 'xxx' }, ['age->年龄', '$+50+_.random(1, 10)'], { name: 'class', newName: '班级' }] });
  // const transformer = TransformStream({ list: [{ newName: 'yun', value: ' $$.targetId' }] });
  const transformer = TransformStream({ list: [{ newName: 'yun', value: ' $$.name' }] });
  const script = ScriptTransform('1.js');
  const uniq = UniqueTransform();
  const json = JsonWriter('3.json');
  const group = GroupTransform('name', {
    name: 1,
    age: '+',
    class: 'm',
  });

  const post = PostStream({
    url: 'http://localhost:6000/test',
    inFormat: o => ({ ...o, fang: 123 }),
    outFormat: o => o.result,
  });

  // const writer = WriteStream({ file: '1.txt', widths: { 年龄: 5, 班级: 10 } });
  // const writer = WriteStream({ file: '2.xlsx' });
  // const writer = WriteStream({ file: '2.xlsx' });
  // const writer = await MongodbWriter({ uri: 'mongodb://localhost:27017', database: 'fang', table: 'tb_role1' });
  // reader.pipe(transformer).pipe(uniq).pipe(json);
  reader.pipe(group).pipe(json);
})()
